﻿@model JsxyUIS.WebClient.Models.LoginViewModel
@using JsxyUIS.Framework

@{
    ViewBag.Title = "Login";
}

@section Header{
    <script type="text/javascript">
        $(function () {
            var loginForm = $("#loginForm");
            $(window).resize(function () { loginForm.dialog("center"); });
            loginForm.form("disableValidation").form("enableValidation");

            $("#btnSubmit").click(function () {
                var data = loginForm.form("getData");
                $.post('@VirtualPathUtility.ToAbsolute("~/Home/Login")', data, function (ret) {
                    if (ret && ret.status && ret.url) {
                        window.location.href = ret.url;
                    } else {
                        $.easyui.showOption(ret);
                    }
                }, "json");
            });

            $("#btnReset").click(function () {
                loginForm.form("reset")
            });
        });
    </script>
    <style>
        #loginForm tr td {
            vertical-align: middle;
            padding: 3px 0 3px 0;
        }

            #loginForm tr td.left {
                width: 30%;
                text-align: right;
                font-size: 14px;
            }

            #loginForm tr td.right {
                text-align: left;
            }
    </style>
}

<div id="loginForm" class="easyui-dialog" data-options="width: 400, height: 240, closable: false, resizable: false, collapsible: true, maximizable: true, buttons: '#loginFormButtons'">
    <table style="width: 100%;">
        <caption style="font-size: large; font-weight: bold; font-family: 方正舒体; padding-top: 10px;">统一身份认证平台-系统登录</caption>
        <tr>
            <td class="left">@Html.DisplayNameFor(m => m.LoginCode)</td>
            <td class="right">@Html.TextBoxFor(m => m.LoginCode, EasyuiHtmlHelper.Create(new { @class = "easyui-validatebox", options = "required: true, autoFocus: true" }))</td>
        </tr>
        <tr>
            <td class="left">@Html.DisplayNameFor(m => m.Password)</td>
            <td class="right">@Html.PasswordFor(m => m.Password, EasyuiHtmlHelper.Create(new { @class = "easyui-validatebox", options = "required: true" }))</td>
        </tr>
        <tr>
            <td class="left">@Html.DisplayNameFor(m => m.VerifyCode)</td>
            <td class="right">@Html.TextBoxFor(m => m.VerifyCode, EasyuiHtmlHelper.Create(new { @class = "easyui-validatebox", options = "required: true", style = "width: 50px; margin-left: 2px;" }))</td>
        </tr>
        <tr>
            <td class="left"></td>
            <td class="right">
                <label>
                    @Html.CheckBoxFor(m => m.RememberMe, EasyuiHtmlHelper.Create(new { @class = "easyui-validatebox", options = "required: true" }))
                    @Html.DisplayNameFor(m => m.RememberMe)
                </label>
            </td>
        </tr>
    </table>
</div>

<div id="loginFormButtons">
    <a id="btnSubmit" class="easyui-linkbutton" data-options="iconCls: 'icon-hamburg-login'">登录</a>
    <a id="btnReset" class="easyui-linkbutton" data-options="iconCls: 'icon-standard-cancel'">重置</a>
</div>
